expander: Call set_realized() later
authorBenjamin Otte <otte@redhat.com>
Thu, 20 Mar 2014 13:11:02 +0000 (14:11 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 20 Mar 2014 13:20:49 +0000 (14:20 +0100)
Widgets should only call set_realized() after having created and
registered their GDK windows. In this case, the creation of the style
context (or more exactly: figuring out the scale factor for it) requires
knowing if the widget is already realized. Which it isn't.

https://bugzilla.gnome.org/show_bug.cgi?id=726717

gtk/gtkexpander.c

index 0380e6bae64dccb1112d51863b6f4f06c7a438a9..c99c9663d91194978bb51828a71dc5e454b5ab56 100644 (file)
@@ -527,8 +527,6 @@ gtk_expander_realize (GtkWidget *widget)
 
   priv = GTK_EXPANDER (widget)->priv;
 
-  gtk_widget_set_realized (widget, TRUE);
-
   border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
   get_expander_bounds (GTK_EXPANDER (widget), &expander_rect);
@@ -567,6 +565,8 @@ gtk_expander_realize (GtkWidget *widget)
   priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
                                        &attributes, attributes_mask);
   gtk_widget_register_window (widget, priv->event_window);
+
+  gtk_widget_set_realized (widget, TRUE);
 }
 
 static void